package cate.game.role.pvp.throne.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTB;
import cate.game.pvp.throne.data.ko.TBKoAdvanceGroup;
import cate.game.pvp.throne.dto.TBGroupDataDTO;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "淘汰赛排行榜 の 请求")
public class TBKoRankReq implements MsgInput {

    @NoteField("等级组")
    public int group;

    @NoteField(value = "分组类型",detail = "1胜者组 2败者组")
    public int groupType;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        TBGroupDataDTO groupData = game.pvp.throne.data.holder.groupMap.get(group);
        TBKoAdvanceGroup advanceGroup = groupData.ko.advance.groups.get(groupType);
        TBKoRankResp resp = new TBKoRankResp();
        resp.group = group;
        resp.groupType = groupType;
        resp.rankList = advanceGroup.rank.rankList;
        resp.my = advanceGroup.rank.findByUid(cc.getRole().getUid());
        resp.myRank = advanceGroup.rank.findRankByUid(cc.getRole().getUid());
        resp.sendNow(cc.getRole());
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTB.KO_RANK_REQ;
    }
}
